imwayland: Fix a small leak
authorMichael Catanzaro <mcatanzaro@igalia.com>
Sun, 24 Jun 2018 20:49:46 +0000 (15:49 -0500)
committerDaniel Boles <dboles.src@gmail.com>
Mon, 25 Jun 2018 21:20:09 +0000 (22:20 +0100)
If the parent get_preedit_string implementation returns a nonnull
zero-length string, then we ignore it, which is almost fine. We have to
free it, though.

Fixes #1174

gtk/gtkimcontextwayland.c

index e9cc6a6eb2fc48b1c60447e02f71d43f265a0318..141ad6c6c99be005a6ea06898aac911fbbffa164 100644 (file)
@@ -472,8 +472,13 @@ gtk_im_context_wayland_get_preedit_string (GtkIMContext   *context,
   GTK_IM_CONTEXT_CLASS (gtk_im_context_wayland_parent_class)->get_preedit_string (context, str, attrs, cursor_pos);
 
   /* If the parent implementation returns a len>0 string, go with it */
-  if (str && *str && **str)
-    return;
+  if (str && *str)
+    {
+      if (**str)
+        return;
+
+      g_free (*str);
+    }
 
   preedit_str =
     context_wayland->preedit.text ? context_wayland->preedit.text : "";